package com.simple.ds.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.simple.common.entity.po.MerchantApiChannelEntity;
import com.simple.ds.mapper.MerchantApiChannelMapper;
import com.simple.ds.service.MerchantApiChannelService;
import org.springframework.stereotype.Service;

/**
 * @author yasud
 * @date 2021年09月17日 15:34
 * @description
 */
@Service
public class MerchantApiChannelServiceImpl extends ServiceImpl<MerchantApiChannelMapper, MerchantApiChannelEntity> implements MerchantApiChannelService {

    @Override
    public MerchantApiChannelEntity findByMerchantCodeAndApiCode(String merchantCode, String apiCode) {
        QueryWrapper<MerchantApiChannelEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(MerchantApiChannelEntity::getMerchantCode, merchantCode);
        queryWrapper.lambda().eq(MerchantApiChannelEntity::getApiCode, apiCode);
        queryWrapper.lambda().eq(MerchantApiChannelEntity::getEnabled, true);
        return getOne(queryWrapper);
    }
}
